// 标签页,公共布局 (一级路由)
const Layout = () => import('@/views/layout')
// 首页(二级路由)
const Home = () => import('@/views/home')
// 问答(二级路由)
const Question = () => import('@/views/question')
// 视频(二级路由)
const Video = () => import('@/views/video')
// 个人中心(二级路由)
const User = () => import('@/views/user/index')
// 编辑资料(一级路由)
const Profile = () => import('@/views/profile')
// 小智同学(一级路由)
const Chat = () => import('@/views/user/chat')
// 登录(一级路由)
const Login = () => import('@/views/login')
// 搜索(一级路由)
const Search = () => import('@/views/search/index')
// 搜索结果(一级路由)
const Result = () => import('@/views/search/result')
// 文章详情(一级路由)
const Article = () => import('@/views/article')
// 配置路由
const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/',
        name: 'Home',
        // 首页
        component: Home,
        // 需要缓存
        meta: { isKeepAlive: true }
      },
      {
        path: '/question',
        name: 'Question',
        // 问答
        component: Question
      },
      {
        path: '/video',
        name: 'Video',
        // 视频
        component: Video
      },
      {
        path: '/user',
        name: 'User',
        // 个人中心
        component: User
      }
    ]
  },
  {
    path: '/profile',
    name: 'Profile',
    // 编辑
    component: Profile
  },
  {
    path: '/user/chat',
    name: 'Chat',
    // 小智
    component: Chat
  },
  {
    path: '/login',
    name: 'Login',
    // 登录
    component: Login
  },
  {
    path: '/search',
    name: 'Search',
    // 搜索
    component: Search
  },
  {
    path: '/search/result',
    name: 'Result',
    // 搜索结果
    component: Result
  },
  {
    path: '/article/:id',
    name: 'Article',
    // 文章详情
    component: Article,
    // 需要缓存
    meta: { isKeepAlive: true }
  }
]
export default routes
